[Unit]
Description=Availability of lockspaces in lvmlockd
Documentation=man:lvmlockd(8)
After=lvm2-lvmlockd.service sanlock.service dlm.service

[Service]
Type=oneshot
RemainAfterExit=yes

# start lockspaces and wait for them to finish starting
ExecStart=/usr/sbin/lvm vgchange --lock-start --lock-opt autowait

# auto activate LVs in the newly started lockd VGs
ExecStart=/usr/sbin/lvm vgchange -aay -S 'locktype=sanlock || locktype=dlm'

# deactivate LVs in lockd VGs
ExecStop=/usr/sbin/lvm vgchange -an -S 'locktype=sanlock || locktype=dlm'

# stop lockspaces and wait for them to finish stopping
ExecStop=/usr/sbin/lvmlockctl --stop-lockspaces --wait 1

[Install]
WantedBy=multi-user.target

